﻿using System;

using System.Collections.Generic;
using System.Text;

namespace WABDCUI
{
    public class Book
    {
        private int id;
        private string name;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public override string ToString()
        {
            return this.name;
        }
    }

    public class Lesson
    {
        private int id;
        private string name;
        private Book book;
        private int numberOfWords;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public Book Book
        {
            get { return book; }
            set { book = value; }
        }

        public int NumberOfWords
        {
            get { return numberOfWords; }
            set { numberOfWords = value; }
        }
    }

    public class Recite
    {
        private int id;
        private string name;
        private int numberOfWords;
        private DateTime createTime;
        private DateTime accessTime;
        private int accessCount;
        private List<Lesson> lessons;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public List<Lesson> Lessons
        {
            get { return lessons; }
            set { lessons = value; }
        }

        public int NumberOfWords
        {
            get { return numberOfWords; }
            set { numberOfWords = value; }
        }

        public DateTime CreateTime
        {
            get { return createTime; }
            set { createTime = value; }
        }

        public DateTime AccessTime
        {
            get { return accessTime; }
            set { accessTime = value; }
        }

        public int AccessCount
        {
            get { return accessCount; }
            set { accessCount = value; }
        }

        override public string ToString()
        {
            String str = String.Format("{0}\n{1}个课程：", this.name, this.lessons.Count);
            if (lessons.Count <= 4)
            {
                for (int i = 0; i < lessons.Count; i ++)
                {
                    Lesson lesson = this.lessons[i];
                    if (i == lessons.Count - 1)
                    {
                        str += lesson.Name;
                    }
                    else
                    {
                        str += lesson.Name + ",";
                    }
                    
                }
            }
            else
            {
                str += String.Format("{0},{1},...,{2}", lessons[0].Name, lessons[1].Name, lessons[lessons.Count - 1].Name);
            }
            str += ",共" + this.numberOfWords + "个单词";
            return str;
        }
    }

    public class NewWord
    {
        private int id;
        private Word word;
        private DateTime createTime;
        private DateTime accessTime;
        private int accessCount;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        public Word Word
        {
            get { return word; }
            set { word = value; }
        }

        public DateTime CreateTime
        {
            get { return createTime; }
            set { createTime = value; }
        }

        public DateTime AccessTime
        {
            get { return accessTime; }
            set { accessTime = value; }
        }

        public int AccessCount
        {
            get { return accessCount; }
            set { accessCount = value; }
        }

        override public string ToString()
        {
            return this.word.ToString();
        }
    }

    public class Word
    {
        private int id;
        private Lesson lesson;
        private string spelling;
        private string pronunciation;
        private string description;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        public Lesson Lesson
        {
            get { return lesson; }
            set { lesson = value; }
        }

        public string Spelling
        {
            get { return spelling; }
            set { spelling = value; }
        }

        public string Pronunciation
        {
            get { return pronunciation; }
            set { pronunciation = value; }
        }

        public string Description
        {
            get { return description; }
            set { description = value; }
        }

        override public string ToString()
        {
            return this.spelling + " [" + this.pronunciation + "]  " + this.description;
        }
    }

}
